﻿@model CultuRAM.Models.EventPropertyValue

@{
    ViewBag.Title = "Editar";

}

    <h4>Editar</h4>

    @using (Ajax.BeginForm("EditPv", "EventPropertyValues", new AjaxOptions
        {
            UpdateTargetId = "tabEventPropRight",
            InsertionMode = InsertionMode.Replace,
            HttpMethod = "POST",
            OnSuccess = "UpdateEventProp(" + @Model.Event.EventId + ")"
        }))


    {
        @Html.ValidationSummary(false)

        <fieldset>
            <legend>EventPropertyValue</legend>

            @Html.HiddenFor(model => model.PropertyValueId)
            @Html.HiddenFor(model => model.Event.EventId, new { id = "EventId" }) @*//NAO ALTERAR*@
            @Html.HiddenFor(model => model.Event.Title)
            @Html.HiddenFor(model => model.EventProperty.PropertyId,  new { id = "EventPropertyId" })
            @Html.HiddenFor(model => model.EventProperty.Name)
        
            <div class="editor-label">
                @Html.LabelFor(model => model.EventProperty)
            </div>

            <div class="editor-field">
                @Html.DropDownListFor(model => model.EventProperty.PropertyId, (SelectList)ViewBag.EventPropertyIdDdl, "- Selecione -" , new { id = "EventPropertyIdEdit"})
                @*@Html.ValidationMessageFor(model => model.EventPropertyId)*@
            </div>

            <div class="editor-label">
                @Html.LabelFor(model => model.Value)
            </div>
            <div class="editor-field">
                @switch(Model.EventProperty.PropertyId)
                {
                    case 1:
                        @Html.DropDownListFor(model => model.Value, (SelectList)ViewBag.EventStates, "- Selecione -" , new { id = "Value" })    
                        break;
                    case 2:
                        @Html.DropDownListFor(model => model.Value, (SelectList)ViewBag.Places, "- Selecione -" , new { id = "Value" })    
                        break;
                    case 3:
                        @Html.DropDownListFor(model => model.Value, (SelectList)ViewBag.WeekDays, "- Selecione -" , new { id = "Value" })    
                        break;
                    case 5:
                        @Html.TextAreaFor(model => model.Value, new { @id="txta", @style="height: 100px; width: 98% !important;"})    
                        break;
                    case 7:
                        @Html.DropDownListFor(model => model.Value, (SelectList)ViewBag.Targets, "- Selecione -" , new { id = "Value" })    
                        break;
                    case 8:
                        @Html.TextAreaFor(model => model.Value, new { @id="txta", @style="height: 100px; width: 98% !important;"})    
                        break;
                    case 9:
                        @Html.TextAreaFor(model => model.Value, new { @id="txta", @style="height: 100px; width: 98% !important;"})    
                        break;
                    case 10:
                        @Html.DropDownListFor(model => model.Value, (SelectList)ViewBag.YesNo, "- Selecione -" , new { id = "Value" })    
                        break;
                    case 11:
                        @Html.DropDownListFor(model => model.Value, (SelectList)ViewBag.YesNo, "- Selecione -" , new { id = "Value" })    
                        break;
                    case 12:
                        @Html.DropDownListFor(model => model.Value, (SelectList)ViewBag.YesNo, "- Selecione -" , new { id = "Value" })    
                        break;
                    default:
                        @Html.TextBoxFor(model => model.Value)
                        break;
                }
            </div>
   
            <p>
                <br />
                <button  type="submit" value="Guardar" class="btn btn-primary"><i class="icon-ok icon-white"></i> Guardar</button>
                @Html.Raw(@Ajax.ActionLink("replacetxt", "Default", null, new AjaxOptions
		            {
			                UpdateTargetId="tabEventPropRight", 
                            InsertionMode = InsertionMode.Replace, 
                            HttpMethod = "GET", 
                            OnComplete = "PropBgColorClear()"
		            }, new { @class = "btn btn-default" })
		            .ToHtmlString().Replace("replacetxt", "<i class=\"icon-ban-circle\"></i> Cancelar"))
            </p>
        </fieldset>
    }


 @Scripts.Render("~/bundles/culturam")


